package org.web.tablesqlcheck.server.controller;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.web.tablesqlcheck.sdk.dto.SqlCheckRequest;
import org.web.tablesqlcheck.server.domain.TableDefinitionRuleDO;
import org.web.tablesqlcheck.server.domain.query.QueryTableDefinitionRule;
import org.web.tablesqlcheck.server.service.TableDefinitionRuleService;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("/")
public class TableSqlCheckController {

    private static final Logger logger = LogManager.getLogger(TableSqlCheckController.class);

    @Resource
    private TableDefinitionRuleService tableDefinitionRuleService;

    @RequestMapping("helloWorld")
    @ResponseBody
    public String sayHelloWorld(SqlCheckRequest sqlCheckRequest) {
        QueryTableDefinitionRule queryTableDefinitionRule = new QueryTableDefinitionRule();
        List<TableDefinitionRuleDO> list = tableDefinitionRuleService.selectTableDefinitionRuleList(queryTableDefinitionRule);

        return "welcome to world, " + sqlCheckRequest;
    }

}
